package operator;

import book.BookList;

import java.util.Scanner;

public class FindOperator implements Operator{

    @Override
    public void work(BookList bookList) {
        System.out.println("-----查找图书------");
        System.out.println("请输入图书的名字：");
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for (int i = 0; i < bookList.getUsebook(); i++) {
            if(s.equals(bookList.getBooks(i).getName())) {
                System.out.println(bookList.getBooks(i));
                return;
            }
        }
        System.out.println("没有该名字的书");
        return;
    }
}
